home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / ctutor2 / cryptic.c < prev    next >
Text File  |  1986-05-27  |  2KB  |  39 lines

  1. main()
  2. {
  3. int x = 0,y = 2,z = 1025;
  4. float a = 0.0,b = 3.14159,c = -37.234;
  5.  
  6.                                               /* incrementing */
  7.    x = x + 1;       /* This increments x */
  8.    x++;             /* This increments x */
  9.    ++x;             /* This increments x */
  10.    z = y++;         /* z = 2, y = 3 */
  11.    z = ++y;         /* z = 4, y = 4 */
  12.  
  13.                                               /* decrementing */
  14.    y = y - 1;       /* This decrements y */
  15.    y--;             /* This decrements y */
  16.    --y;             /* This decrements y */
  17.    y = 3;
  18.    z = y--;         /* z = 3, y = 2 */
  19.    z = --y;         /* z = 1, y = 1 */
  20.  
  21.                                               /* arithmetic op */
  22.    a = a + 12;      /* This adds 12 to a */
  23.    a += 12;         /* This adds 12 more to a */
  24.    a *= 3.2;        /* This multiplies a by 3.2 */
  25.    a -= b;          /* This subtracts b from a */
  26.    a /= 10.0;       /* This divides a by 10.0 */
  27.  
  28.                                      /* conditional expression */
  29.    a = (b >= 3.0 ? 2.0 : 10.5 );     /* This expression     */
  30.  
  31.    if (b >= 3.0)                     /* And this expression */
  32.       a = 2.0;                       /* are identical, both */
  33.    else                              /* will cause the same */
  34.       a = 10.5;                      /* result.             */
  35.  
  36.    c = (a > b?a:b);        /* c will have the max of a or b */
  37.    c = (a > b?b:a);        /* c will have the min of a or b */
  38. }
  39.